package;

import board.Dice;
import board.Roulette;
import board.Team;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;
import flixel.input.gamepad.LogitechButtonID;
import flixel.input.gamepad.PS4ButtonID;
import flixel.util.FlxColor;
import haxe.Utf8;

/**
 * A FlxState which can be used for the actual gameplay.
 */
class PlayState extends FlxState
{
	public var text:FlxText;
	/**
	 * Function that is called up when to state is created to set it up. 
	 */
	override public function create():Void
	{
		super.create();
		text = new FlxText(0, 300, 800, Utf8.decode("ñ"));
		text.setFormat("font", 40,FlxColor.BLUE,"center");
		add(text);
	}
	
	/**
	 * Function that is called when this state is destroyed - you might want to 
	 * consider setting all objects this state uses to null to help garbage collection.
	 */
	override public function destroy():Void
	{
		super.destroy();
	}

	/**
	 * Function that is called once every frame.
	 */
	override public function update():Void
	{
		super.update();
		var gamePad  = FlxG.gamepads.lastActive;
		if (gamePad != null && gamePad.justPressed(LogitechButtonID.ONE))
			text.text = "ONE";
		if (gamePad != null && gamePad.justPressed(LogitechButtonID.THREE))
			text.text = "THREE";
		if (gamePad != null && gamePad.justPressed(LogitechButtonID.FOUR))
			text.text = "FOUR";
		if (gamePad != null && gamePad.justPressed(LogitechButtonID.TWO))
			text.text = "TWO";
	}	
}